const http = require('../utils/http.js');

// 获取当前用户的收货地址列表
const getAddressList = () => {
    return http.request('GET', '/UserAddress/current')
}

// 新增用户地址
const newAddress = (data) => {
    return http.request('POST', '/UserAddress', data)
}

// 修改用户地址
const editAddress = (data) => {
    return http.request('PUT', '/UserAddress', data)
}

// 删除用户地址
const delAddress = (id) => {
    return http.request('DELETE', `/UserAddress?id=${id}`)
}

// 设置默认地址
const setDefaultAddress = (data) => {
    return http.request('PUT', '/UserAddress/setDefault', data)
}

module.exports = {
    getAddressList,
    newAddress,
    editAddress,
    delAddress,
    setDefaultAddress
}